<%= render "connectors/_header.html", conn: @conn, connector: @connector %>

<%= connector_article conn: @conn, title: @seo.title, features: [
    %{name: "Tables", available: true},
    %{name: "Relations", available: true},
    %{name: "Statistics", available: false},
    %{name: "Query history", available: false},
    %{name: "Query data", available: true}
] do %>
    <p class="lead">
        <a href="https://cloud.google.com/bigquery" target="_blank" rel="noopener noreferrer">BigQuery</a> is Google Cloud's fully-managed,
        serverless data warehouse designed for large-scale analytics and business intelligence.
        It enables users to quickly analyze massive datasets using SQL without worrying about infrastructure management.
        BigQuery is ideal for organizations that need to run complex queries on large volumes of data, offering near real-time insights with fast querying speeds.
    </p>
    <%= render "connectors/_promo.html" %>
    <p>
        The <a href="https://github.com/azimuttapp/azimutt/tree/main/libs/connector-bigquery" target="_blank" rel="noopener noreferrer">BigQuery connector</a>
        on GitHub if you are interested in how it works, or improving it.<br>
        You will most likely want to have a look at the <code>getSchema</code> function in
        <a href="https://github.com/azimuttapp/azimutt/blob/main/libs/connector-bigquery/src/bigquery.ts" target="_blank" rel="noopener noreferrer">src/bigquery.ts</a>.
    </p>
    <p>
        Few people know and use it but BigQuery has relations. They are not enforced like foreign keys on relational databases, but they help understand your data model.<br>
        You will most likely not have them, and Azimutt will <a href={Routes.website_path(@conn, :doc, ["infer-relations"])}>infer the relations</a> it can for you,
        but it could be a good idea to report them back to BigQuery as the golden source of truth.
    </p>

    <%= render "docs/_h3.html", title: "How to use it" %>
    <p>The BigQuery connector is already included in the Azimutt Gateway, use it following these steps:</p>
    <ul>
        <li>Launch your Gateway, if needed (for the local one use <code>npx azimutt@latest gateway</code>)</li>
        <li><a href={"#{Routes.elm_path(@conn, :new)}?database"}>Create a new project</a> or add a source to an existing one</li>
        <li>Download your account key on your computer</li>
        <li>
            Fill your BigQuery database url (ex: <code>bigquery://bigquery.googleapis.com/your_project?key=path/to/key.json</code>)<br>
            You can add additional paramters to your url to control the connector behavior:
            <ul>
                <li><strong>dataset</strong>: filter the datasets to inspect, supports the LIKE syntax</li>
                <li><strong>table</strong>: filter the tables to inspect, supports the LIKE syntax</li>
            </ul>
        </li>
    </ul>
    <img src={Routes.static_path(@conn, "/images/connectors/azimutt-project-new.png")} alt="Azimutt create project" />
    <p>Here are <a href={Routes.website_path(@conn, :doc, ["data-privacy"])}>more details</a> about how Azimutt secure your data and especially your database url.</p>
    <p>
        Here is an example of what you can achieve with Azimutt:
        <img src={Routes.static_path(@conn, "/images/connectors/azimutt-diagram.png")} alt="Azimutt diagram" />
    </p>
<% end %>

<%= render "connectors/_footer.html", conn: @conn, connector: @connector %>
